#include <cstring>
#include <iostream>
#include <queue>
using namespace std;
const int N = 21;
int n;
int a[N], b[N];
int dxy[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
bool pd[N][N];
deque<int> q;

bool check() {
    for (int i = 0; i < n; ++i) {
        if (a[i] != 0 || b[i] != 0)
            return false;
    }
    return true;
}

void dfs(int x, int y) {
    if (x == n - 1 && x == y) {
        if (check()) {
            while (!q.empty()) {
                cout << q.front() << " ";
                q.pop_front();
            }
            cout << endl;
            exit(0);
        } else {
            return;
        }
    }
    for (int i = 0; i < 4; ++i) {
        int dx = x + dxy[i][1];
        int dy = y + dxy[i][0];
        if (dx < 0 || dx >= n || dy < 0 || dy >= n)
            continue;
        if (pd[dx][dy])
            continue;
        if (a[dx] < 1 || b[dy] < 1)
            continue;
        pd[dx][dy] = true;
        --a[dx], --b[dy];
        q.push_back(dx * n + dy);
        dfs(dx, dy);
        q.pop_back();
        ++a[dx], ++b[dy];
        pd[dx][dy] = false;
    }
}

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> b[i];
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    --a[0], --b[0];
    q.push_back(0);
    pd[0][0] = true;
    dfs(0, 0);
    return 0;
}